package appLoader.loaders {
	
	import appLoader.data.PropertyTable;
	
	public class LoaderPropertyXML extends LoaderXML {
		
		public function LoaderPropertyXML() {}
		
		private function parseXML(xml:XML) : PropertyTable {
			var propertyTable : PropertyTable = new PropertyTable();
			var xmlElements:XMLList = xml.e;
			var length:int = xmlElements.length();
			var key:String;
			var value:*;
			for(var i:int = 0; i< length;i++){
				key = xmlElements[i].@k.toString();
				value =xmlElements[i].toString();				
				if (String(value).indexOf("|") != -1) value = String(value).split("|");
				propertyTable.put (key, value);			
			}
			return propertyTable;			
		}
		
		
		public function getPropertyTable() : PropertyTable{
			return parseXML(XML(this.getData()));	
		}
		
		public override function toString():String {
			return "[ LoaderPropertyXML ]";
		}
	}
}